<?php
// $Id: header.php 98 2008-02-28 21:45:09Z mikhail.miguel $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;

$modulename = basename( dirname( __FILE__ ) );

$module_handler =& xoops_gethandler('module');
$xoopsModule =& $module_handler->getByDirname($modulename);
if (!$xoopsModule || !$xoopsModule->getVar('isactive')) {
	include_once XOOPS_ROOT_PATH."/header.php";
	echo "<h4>"._MODULENOEXIST."</h4>";
	include_once XOOPS_ROOT_PATH."/footer.php";
	exit();
}
$moduleperm_handler =& xoops_gethandler('groupperm');
if ($xoopsUser) {
	if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
		redirect_header(XOOPS_URL."/user.php",1,_NOPERM);
		exit();
	}
	$xoopsUserIsAdmin = $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
} else {
	if (!$moduleperm_handler->checkRight('module_read', $xoopsModule->getVar('mid'), XOOPS_GROUP_ANONYMOUS)) {
		redirect_header(XOOPS_URL."/user.php",1,_NOPERM);
		exit();
	}
}
if ( file_exists(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/".$xoopsConfig['language']."/main.php") ) {
	include_once XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/".$xoopsConfig['language']."/main.php";
} else {
	if ( file_exists(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/english/main.php") ) {
		include_once XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar('dirname')."/language/english/main.php";
	}
}

if ($xoopsModule->getVar('hasconfig') == 1 || $xoopsModule->getVar('hascomments') == 1 || $xoopsModule->getVar( 'hasnotification' ) == 1) {
    $config_handler =& xoops_gethandler('config');
    $xoopsModuleConfig =& $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid'));
}

define('XOOPSPARTNERURL', XOOPS_URL."/modules/$modulename");
define('XOOPSPARTNERPATH', XOOPS_ROOT_PATH."/modules/$modulename");

include_once XOOPSPARTNERPATH.'/class/partners.php';
include_once XOOPSPARTNERPATH."/class/partnerpagenav.php";
include_once XOOPSPARTNERPATH."/include/functions.php";

?>